package com.magic.smartcity.view.more.adapters

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.magic.smartcity.R
import com.magic.smartcity.beans.ParkBannerBean
import com.magic.smartcity.beans.ParkRecordBean
import com.magic.smartcity.databinding.ItemBaseBannerImageBinding
import com.magic.smartcity.utils.Constant
import com.youth.banner.adapter.BannerAdapter

/**
 * @description:
 * @create: Create by Magic on 2022/2/23.
 */
class ParkBannerAdapter(data: List<ParkBannerBean>) :
    BannerAdapter<ParkBannerBean, ParkBannerAdapter.ItemHolder>(data) {
    class ItemHolder(binding: ItemBaseBannerImageBinding) : RecyclerView.ViewHolder(binding.root) {
        val binding = binding
    }

    private val TAG: String = "ParkBannerAdapter"
    override fun onCreateHolder(parent: ViewGroup?, viewType: Int): ItemHolder {
        val inflate = DataBindingUtil.inflate<ItemBaseBannerImageBinding>(
            LayoutInflater.from(parent?.context),
            R.layout.item_base_banner_image,
            parent, false
        )
        return ItemHolder(inflate)
    }

    override fun onBindView(holder: ItemHolder?, data: ParkBannerBean?, position: Int, size: Int) {
        Glide.with(holder!!.binding.bannerImage).load(Constant.Service_IP+data!!.advImg).error(R.color.gray)
            .into(holder.binding.bannerImage)
    }

}